<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"> </script>
</head>
<body>
  <!-- 
    watch 数据是新的的dom还是修改之前的
  -->
  <div id="app">
    <p ref="p">{{sel}}</p>
    <button @click="toggle">change</button>
  </div>

  <script>
    new Vue({
      el: "#app",
      data: {
        sel: "爱情"
      },
      watch: {
        sel(newV,old) {
          console.log(newV)
          console.log(this.$refs.p)
          console.log(this.$refs.p.innerHTML)
        }
      },
      methods: {
        toggle() {
          this.sel = "hehe"
        }
      }
    })

  </script>
</body>
</html>